import service from '../../utils/request'

// 仓库相关接口
export const warehouseApi = {
    // 获取仓库列表（分页）
    getList(params) {
        return service({
            url: '/warehouse/page',
            method: 'get',
            params
        })
    },
    getListAll() {
        return service.get('/warehouse/list')
    },
    // 添加仓库
    add(data) {
        return service({
            url: '/warehouse',
            method: 'post',
            data
        })
    },

    // 更新仓库
    update(data) {
        return service({
            url: `/warehouse`,
            method: 'put',
            data
        })
    },

    // 删除仓库
    delete(id) {
        return service({
            url: `/warehouse/${id}`,
            method: 'delete'
        })
    },

    // 批量删除仓库
    batchDelete(ids) {
        return service({
            url: '/warehouse/batch',
            method: 'delete',
            data: ids
        })
    }
}

// 获取仓库列表
export function getWarehouseList(params) {
    return service({
        url: '/warehouse/list',
        method: 'get',
        params
    })
}